﻿<%@LANGUAGE="JAVASCRIPT" %>

<%
	var json = 		new String(Request.Form("json"));
	var fileName = 	new String(Request.Form("fileName"));

	json = json.replace(/(^"|"$)/g, "") //quotes at the beginning or quotes at the end. removed here because client-side had to pass it wrapped in quotes so that JS didn't try to eval it.
	
	if(fileName && fileName != ""){
		fileName += ".script";
	}
	else{
		fileName = "exportedScript.script";
	}
	
	Response.AddHeader("Content-disposition", "attachment; filename=" + fileName);
	Response.ContentType = "application/octet-stream";
	Response.Write(json);

%>
